package com.example.designModel.agency.base;

import java.util.Optional;

/**
 * XXXXXXXXX
 *
 * @author brad zhang
 * @version 2.0
 * @date 2021/11/17 16:27
 */
public class Program {

    public static void main(String[] args) {
        Boolean a = null;
        System.out.println(!Optional.ofNullable(true).orElse(false));
        System.out.println(!Optional.ofNullable(a).orElse(false));
        // Proxy proxy = new Proxy();
        // proxy.Request();
    }
    static abstract class Subject
    {
        public abstract void Request();
    }

    static class RealSubject extends Subject
    {
        public  void Request()
        {
            System.out.println("真实的请求");
        }
    }

    static class Proxy extends Subject
    {
        RealSubject realSubject;
        public void Request()
        {
            if (realSubject == null)
            {
                realSubject = new RealSubject();
            }

            realSubject.Request();
        }
    }
}
